<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="css/Default.css" />
<Script language="javascript" src="data/password.js"></script>
<Script language="javascript" src="exec/login.js"></script>
<noscript>
location.href="noscript.html";
</noscript>
<SCRIPT LANGUAGE="JavaScript">
	window.onload = redir(1);
//name of cookie: 'eomdmf'

</SCRIPT>

</head>

<body bgcolor="2d5306">
<?php

//import form information 
$announcements = $_POST['Announcements'];
$announcements = stripslashes($announcements); //Removes all slashes
?>


<table height="100%" width="100%" border="0">
<tr>
<td>
<center>
			<p style="font-family: Arial; font-size:20px"> Your events have been saved.</p>

			<FORM METHOD="LINK" ACTION="index.html">
			<INPUT TYPE="submit" VALUE="Home Page">
			</FORM>

			<FORM METHOD="LINK" ACTION="LoggedIn.php">
			<INPUT TYPE="submit" VALUE="Return to Main Menu">
			</FORM>

</center>
</td>
</tr>
</table>

<?php


$fh = fopen("data/ticker.txt", "w+");

if($fh==false)die("unable to create file");

$i=0;
	fwrite($fh,$announcements); //Writes announcements to ticker.txt
fclose($fh);



$fh = fopen("data/ticker.txt", "r");
$i=0;
while(!feof($fh))
{
	$item[$i]=trim(fgets($fh)); //Fills $item array with the items in ticker.txt
	$i++;
}
$num = ($i-1);
fclose($fh);

$filer = fopen("data/dataObject.js", 'r');
$theData = fread($filer, filesize("data/dataObject.js")); //Loads whole file all at once. Since it's a small file, it's safe. If file size gets large, use a different method to do this.
fclose($filer);

$fh = fopen("data/announce_data.js", "w+");
if($fh==false)
	die("unable to create file");
$i=0;

fwrite($fh, $theData); //Writes the data object 
fwrite($fh, "var msg = new Array();"); //Create array
fwrite($fh, "var TICKER_SPEED = 3;"); //Adds ticker default speed



while($i <= $num)
{
	fwrite($fh, "msg[$i] = new dataObject(\"".trim($item[$i])."\" ,\"admin\");\n"); //Put text into object
	$i++;
}
fclose($fh);

?>


</body>
</html>
